#include <istream>
#include "grade.h"
#include "Student_info.h"

using namespace std;

//TODO
Student_info::Student_info(const Student_info &s){
    if(s.cp)
        cp = s.cp->clone();
    else
        cp = 0;
}
Student_info & Student_info::operator=(const Student_info &s){
    if (this!=&s){
        delete cp;
        if(s.cp)
            cp = s.cp->clone();
        else
            cp = 0;
    }
    return *this;
}

std::istream & Student_info::read(std::istream &is){
    delete cp;
    char ch;
    is >> ch;
    if(ch == 'U'){
        cp = new Core(is);
    }else{
        cp = new Grad(is);
    }
    return is;
}


